﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace SuperMarioClone.Managers
{
    class TileManager
    {
        ArrayList mTiles;
        public TileManager()
        {
            mTiles = new ArrayList();
        
        }

        public void AddTile(Texture2D text, Vector2 pos, Vector2? offset = null)
        {
            mTiles.Add(new Tile(text, pos, offset));
    
        }
        public void Draw(SpriteBatch spriteBatch)
        { 
            foreach (Tile tile in mTiles )
            {
                spriteBatch.Draw(tile.texture, new Vector2(tile.position.X * 42, tile.position.Y * 42), Color.White);
            
            }
        
        }
    }
    class Tile
    {
        public Texture2D texture;
        public Vector2 position;
        public Vector2 offset;
        public Tile(Texture2D text, Vector2 pos,Vector2? off)
        {
            texture = text;
            position = pos;
            if (off == null)
            {
                offset = new Vector2(0, 0);
            }
            else
                offset = off.Value;
        }
    
    }
}
